Ext.namespace("Maint.Show64");

Maint.Show64.showInfo = function (){
	/* basic info */
    this.txtWoNum = new Ext.form.TextField({fieldLabel: '工单流水号',readOnly: true,width: 160 });
    this.txtUrgency = new Ext.form.TextField({fieldLabel: '紧急程度',readOnly: true,width: 160 });
    this.txtAcceptLimit = new Ext.form.TextField({fieldLabel: '处理时限',readOnly: true,width: 160 });
    this.txtCreateTime = new Ext.form.DateField({fieldLabel: '网管派发时间',width: 160,format: 'Y-m-d',disabledDays: [0-6]});
    this.txtReplyLimit = new Ext.form.TextField({fieldLabel: '回复网管时限',readOnly: true,width: 160 });
    this.txtFaultTime = new Ext.form.DateField({fieldLabel: '客户报障时间',width: 160,format: 'Y-m-d',disabledDays: [0-6]});
    this.txtRepeatWo = new Ext.form.TextField({fieldLabel: '是否重复工单',readOnly: true,width: 160 });
    this.txtCreateDep = new Ext.form.TextField({fieldLabel: '派单部门',readOnly: true,width: 160 });
    this.txtDealWithDep = new Ext.form.TextField({fieldLabel: '处理部门',readOnly: true,width: 160 });
    this.txtFaultType = new Ext.form.TextField({fieldLabel: '报障归类',readOnly: true,width: 160 });
    this.txtFalutProject = new Ext.form.TextField({fieldLabel: '报障项目',readOnly: true,width: 160 });
    this.txtMonitorWo = new Ext.form.TextField({fieldLabel: '跟踪工单',readOnly: true,width: 160 });
    this.txtNum = new Ext.form.TextField({fieldLabel: '流水号',readOnly: true,width: 160 });
    /* customer info */
    this.txtClientName = new Ext.form.TextField({fieldLabel: '客户名称',readOnly: true,width: 160 });
    this.txtMobileTele = new Ext.form.TextField({fieldLabel: '手机号码',readOnly: true,width: 160 });
    this.txtTeleType = new Ext.form.TextField({fieldLabel: '手机型号',readOnly: true,width: 160 });  
	this.txtContactTele = new Ext.form.TextField({fieldLabel: '联系电话',readOnly: true,width: 160 });   
	this.txtContactLocation = new Ext.form.TextField({fieldLabel: '联系地址',readOnly: true,width: 160 });
	this.txtGrid = new Ext.form.TextField({fieldLabel: '相关网元',readOnly: true,width: 160 });
	this.txtLocation = new Ext.form.TextField({fieldLabel: '位置信息',readOnly: true,width: 160 });
	this.txtClientAtt = new Ext.form.TextField({fieldLabel: '客户属性',readOnly: true,width: 160 });
	this.txtBigClient = new Ext.form.TextField({fieldLabel: '大客户属性',readOnly: true,width: 160 });
	/* customer factor */
	this.txtZjLocation = new Ext.form.TextField({fieldLabel: '详细装机地址',readOnly: true,width: 460 });
	this.txtComplainSource = new Ext.form.TextField({fieldLabel: '投诉来源',readOnly: true,width: 460 });
	this.txtStopMach = new Ext.form.TextField({fieldLabel: '是否停机',readOnly: true,width: 160 });
	this.txtFaultRoad2 = new Ext.form.TextField({fieldLabel: '故障交叉路名2',readOnly: true,width: 160 });
	this.txtFaultDis = new Ext.form.TextField({fieldLabel: '故障行政区',readOnly: true,width: 160 });
	this.txtAcceptDep = new Ext.form.TextField({fieldLabel: '受理部门',readOnly: true,width: 160 });
	this.txtMobileType = new Ext.form.TextField({fieldLabel: '手机型号',readOnly: true,width: 160 });
	this.txtUpdateSitu = new Ext.form.TextField({fieldLabel: '机卡更新情况',readOnly: true,width: 160 });
	this.txtClientAdvice = new Ext.form.TextField({fieldLabel: '员工与客户建议',readOnly: true,width: 460 });
	this.txtFloorName = new Ext.form.TextField({fieldLabel: '楼宇名称',readOnly: true,width: 160 });
	this.txtAoyun = new Ext.form.TextField({fieldLabel: '是否奥运场馆',readOnly: true,width: 160 });
	this.txtAcceptMember = new Ext.form.TextField({fieldLabel: '受理员工',readOnly: true,width: 160 });
	this.txtMobileLine1 = new Ext.form.TextField({fieldLabel: '手机是否线路1',readOnly: true,width: 160 });
	this.txtFaultRoad1 = new Ext.form.TextField({fieldLabel: '故障交叉路名1',readOnly: true,width: 160 });
	this.txtClientSign = new Ext.form.TextField({fieldLabel: '客户品牌',readOnly: true,width: 160 });
	this.txtBespeakTime = new Ext.form.DateField({fieldLabel: '答复预约时间',width: 160,format: 'Y-m-d',disabledDays: [0-6]});
	this.txtAcceptDate = new Ext.form.DateField({fieldLabel: '受理日期',width: 160,format: 'Y-m-d',disabledDays: [0-6]});
	this.txtCallNum = new Ext.form.TextField({fieldLabel: '主叫号码',readOnly: true,width: 160 });
	this.txtMobileTele1 = new Ext.form.TextField({fieldLabel: '手机号码',readOnly: true,width: 160 });
	this.txtEquipment = new Ext.form.TextField({fieldLabel: '设备号码',readOnly: true,width: 160 });
	this.txtContent = new Ext.form.TextField({fieldLabel: '听到录音通知内容',readOnly: true,width: 160 });
	this.txtComplainNum = new Ext.form.TextField({fieldLabel: '投诉流水号',readOnly: true,width: 160 });
	this.txtComplainNetworkType = new Ext.form.TextField({fieldLabel: '投诉网络类别',readOnly: true,width: 160 });
	this.txtFloor = new Ext.form.TextField({fieldLabel: '楼宇地址',readOnly: true,width: 160 });
	this.txtSerives = new Ext.form.TextField({fieldLabel: '所使用运营商',readOnly: true,width: 160 });
	this.txtFaultTele = new Ext.form.TextField({fieldLabel: '故障手机号码',readOnly: true,width: 160 });
	this.txtHistoryUse = new Ext.form.TextField({fieldLabel: '历史使用情况',readOnly: true,width: 160 });
	this.txtFaultRoad = new Ext.form.TextField({fieldLabel: '故障路名',readOnly: true,width: 160 });
	this.txtClientName1 = new Ext.form.TextField({fieldLabel: '客户姓名',readOnly: true,width: 160 });
	this.txtFaultTablet = new Ext.form.TextField({fieldLabel: '故障门牌号',readOnly: true,width: 160 });
	this.txtComplainType = new Ext.form.TextField({fieldLabel: '投诉分类',readOnly: true,width: 160 });
	this.txtUseSitu = new Ext.form.TextField({fieldLabel: '周围客户使用情况',readOnly: true,width: 160 });
	this.txtFaultPhe = new Ext.form.TextField({fieldLabel: '故障现象',readOnly: true,width: 160 });
	this.txtFaultTime1 = new Ext.form.DateField({fieldLabel: '故障时间',width: 160,format: 'Y-m-d',disabledDays: [0-6]});
	this.txtServiceId = new Ext.form.TextField({fieldLabel: '服务人员工号',readOnly: true,width: 160 });
	this.txtContacter = new Ext.form.TextField({fieldLabel: '联系人',readOnly: true,width: 160 });
	this.txtComeCallNum = new Ext.form.TextField({fieldLabel: '来电显示号码',readOnly: true,width: 160 });
	this.txtServicePeriod = new Ext.form.TextField({fieldLabel: '服务总时限',readOnly: true,width: 160 });
	this.txtContactTele1 = new Ext.form.TextField({fieldLabel: '联系电话',readOnly: true,width: 160 });
	this.txtCallTime = new Ext.form.TextField({fieldLabel: '通话时间',readOnly: true,width: 160 });
	this.txtComplainCon = new Ext.form.TextField({fieldLabel: '投诉内容',readOnly: true,width: 160 });

	
    this.colseButton = new Ext.Button({
		text:"关闭",
		handler: function(){
			this.hide();
		},
		scope:this
	});

	this.basicPanel = new Ext.form.FormPanel({
		title:'基本信息',
		autoHeight:true,
		autoWidth :true,
		labelWidth: 130,
		labelAlign:'right',
		region:'north',
		layout:'table',
		split:true,
		collapsible: true,
		frame:true,
		layoutConfig:{columns:2},
		style:{algin:'center'},
		items:[
			       {layout: 'form',items: [this.txtWoNum]},
			       {layout: 'form',items: [this.txtUrgency]},
			       {layout: 'form',items: [this.txtAcceptLimit]},
			       {layout: 'form',items: [this.txtCreateTime]},
			       {layout: 'form',items: [this.txtReplyLimit]},
			       {layout: 'form',items: [this.txtFaultTime]},
			       {layout: 'form',items: [this.txtRepeatWo]},
			       {layout: 'form',items: [this.txtCreateDep]},
			       {layout: 'form',items: [this.txtDealWithDep]},
			       {layout: 'form',items: [this.txtFaultType]},
			       {layout: 'form',items: [this.txtFalutProject]},
			       {layout: 'form',items: [this.txtMonitorWo]},
			       {layout: 'form',items: [this.txtNum]}
		]
	});

	this.customerInfoPanel = new Ext.form.FormPanel({
		title:'客户信息',
		autoHeight:true,
		autoWidth :true,
		labelWidth: 130,
		labelAlign:'right',
		region:'north',
		layout:'table',
		split:true,
		collapsible: true,
		frame:true,
		layoutConfig:{columns:2},
		style:{algin:'center'},
		items:[
			       {layout: 'form',items: [this.txtClientName]},
			       {layout: 'form',items: [this.txtMobileTele]},
			       {layout: 'form',items: [this.txtTeleType]},
			       {layout: 'form',items: [this.txtContactTele]},
			       {layout: 'form',items: [this.txtContactLocation]},
			       {layout: 'form',items: [this.txtGrid]},
			       {layout: 'form',items: [this.txtLocation]},
			       {layout: 'form',items: [this.txtClientAtt]},
			       {layout: 'form',items: [this.txtBigClient]}
		]
	});  

	this.customerFactorPanel1 = new Ext.form.FormPanel({
		title:'保障要素Ⅰ',
		autoHeight:true,
		autoWidth :true,
		labelWidth: 130,
		labelAlign:'right',
		region:'north',
		layout:'table',
		split:true,
		collapsible: true,
		frame:true,
		layoutConfig:{columns:2},
		style:{algin:'center'},
		items:[
				{colspan: 2,layout: 'form',items: [this.txtZjLocation]},
				{colspan: 2,layout: 'form',items: [this.txtComplainSource]},
				{layout: 'form',items: [this.txtStopMach ]}, {layout: 'form',items: [this.txtFaultRoad2 ]},
				{layout: 'form',items: [this.txtFaultDis ]}, {layout: 'form',items: [this.txtAcceptDep ]},
				{layout: 'form',items: [this.txtMobileType ]}, {layout: 'form',items: [this.txtUpdateSitu ]},
				{colspan: 2,layout: 'form',items: [this.txtClientAdvice ]},
				{layout: 'form',items: [this.txtFloorName ]}, {layout: 'form',items: [this.txtAoyun ]},
				{layout: 'form',items: [this.txtAcceptMember ]}, {layout: 'form',items: [this.txtMobileLine1 ]},
				{layout: 'form',items: [this.txtFaultRoad1 ]}, {layout: 'form',items: [this.txtClientSign ]},
				{layout: 'form',items: [this.txtBespeakTime ]}, {layout: 'form',items: [this.txtAcceptDate ]},
				{layout: 'form',items: [this.txtCallNum ]}, {layout: 'form',items: [this.txtMobileTele1 ]},
				{layout: 'form',items: [this.txtEquipment ]}, {layout: 'form',items: [this.txtContent ]}
		]
	});  
	
	this.customerFactorPanel2 = new Ext.form.FormPanel({
		title:'保障要素Ⅱ',
		autoHeight:true,
		autoWidth :true,
		labelWidth: 130,
		labelAlign:'right',
		region:'north',
		layout:'table',
		split:true,
		collapsible: true,
		frame:true,
		layoutConfig:{columns:2},
		style:{algin:'center'},
		items:[
				{layout: 'form',items: [this.txtComplainNum ]}, {layout: 'form',items: [this.txtComplainNetworkType ]},
				{layout: 'form',items: [this.txtFloor ]}, {layout: 'form',items: [this.txtSerives ]},
				{layout: 'form',items: [this.txtFaultTele  ]}, {layout: 'form',items: [this.txtHistoryUse ]},
				{layout: 'form',items: [this.txtFaultRoad ]}, {layout: 'form',items: [this.txtClientName1 ]},
				{layout: 'form',items: [this.txtFaultTablet ]}, {layout: 'form',items: [this.txtComplainType ]},
				{layout: 'form',items: [this.txtUseSitu ]}, {layout: 'form',items: [this.txtFaultPhe ]},
				{layout: 'form',items: [this.txtFaultTime1 ]}, {layout: 'form',items: [this.txtServiceId ]},
				{layout: 'form',items: [this.txtContacter ]}, {layout: 'form',items: [this.txtComeCallNum ]},
				{layout: 'form',items: [this.txtServicePeriod ]}, {layout: 'form',items: [this.txtContactTele1 ]},
				{layout: 'form',items: [this.txtCallTime ]}, {layout: 'form',items: [this.txtComplainCon ]}
		]
	}); 
	
	this.cmDes = new Ext.grid.ColumnModel([
		{header:'处理员工号',dataIndex:'DEAL_WITH_ID', width:100},
		{header:'处理时间',dataIndex:'DEAL_WITH_TIME', width:100},
		{header:'说明处理',dataIndex:'DEAL_WITH', width:150},
		{header:'客户建议',dataIndex:'ADVICE', width:100},
		{header:'处理人',dataIndex:'DEAL_WITH_MEMBER', width:90},
		{header:'处理结果',dataIndex:'DEAL_WITH_RESULT', width:90}
	]);
	
	this.customerDesStore = new Ext.data.Store({
		proxy: new Ext.data.HttpProxy({
			url: '../supervise/searchCustomerDesByMaintId.form',
			method: 'POST',
			params: {
			}
		}),
		reader: new Ext.data.JsonReader({
			root: 'result',
			totalProperty: 'total',
			id: 'CUSTOMERDES_ID',
			fields: ['CUSTOMERDES_ID', 'DEAL_WITH_ID', 'DEAL_WITH_TIME', 'DEAL_WITH', 'ADVICE', 'DEAL_WITH_MEMBER', 'DEAL_WITH_RESULT']
		})
	});
	
	this.cmFlow = new Ext.grid.ColumnModel([
		{header:'1860派单时间',dataIndex:'TIME_1860', width:100},
		{header:'1860派单员',dataIndex:'MEMBER_1860', width:100},
		{header:'处理过程及结果',dataIndex:'DEAL_WITH', width:150},
		{header:'条件流程',dataIndex:'CONDITION', width:140},
		{header:'预处理',dataIndex:'PRETREATMENT', width:150}
	]);
	
	this.customerFlowStore = new Ext.data.Store({
		proxy: new Ext.data.HttpProxy({
			url: '../supervise/searchCustomerFlowByMaintId.form',
			method: 'POST',
			params: {
			}
		}),
		reader: new Ext.data.JsonReader({
			root: 'result',
			totalProperty: 'total',
			id: 'CUSTOMERFLOW_ID',
			fields: ['CUSTOMERFLOW_ID', 'TIME_1860', 'MEMBER_1860', 'NET_ACCEPT_TIME', 'NET_ACCEPT', 'NET_REPLY', 'FINALLY_REPLY_DEP',
					'FINALLY_REPLY', 'DEAL_WITH', 'CONDITION', 'PRETREATMENT']
		})
	});
	
	this.customerDesGrid = new Ext.grid.GridPanel({
		store: this.customerDesStore,
		region:'center',
		cm: this.cmDes,
		sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
		bbar: new Ext.PagingToolbar({
			pageSize: 5,
			store: this.store,
			displayInfo: true,
            displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
            emptyMsg: "没有记录"
		}),
		listeners:{
			// 双击事件
			rowdblclick : function(grid ,rowIndex ,e){
				var data = grid.store.getAt(rowIndex).data;
				if (! Maint.Show64DES.showInfo.instance ){
					Maint.Show64DES.showInfo.instance = new Maint.Show64DES.showInfo();
				}
				Maint.Show64DES.showInfo.instance.show();
				Maint.Show64DES.showInfo.instance.initDes(data);
			}
		}
	});
	
	this.customerFlowGrid = new Ext.grid.GridPanel({
		store: this.customerFlowStore,
		region:'center',
		cm: this.cmFlow,
		sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
		bbar: new Ext.PagingToolbar({
			pageSize: 5,
			store: this.store,
			displayInfo: true,
            displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
            emptyMsg: "没有记录"
		}),
		listeners:{
			// 双击事件
			rowdblclick : function(grid ,rowIndex ,e){
				var data = grid.store.getAt(rowIndex).data;
				if (! Maint.Show64FLOW.showInfo.instance ){
					Maint.Show64FLOW.showInfo.instance = new Maint.Show64FLOW.showInfo();
				}
				Maint.Show64FLOW.showInfo.instance.show();
				Maint.Show64FLOW.showInfo.instance.initDes(data);
			}
		}
	});
	
	this.customerDesPanel = new Ext.form.FormPanel({
		title:'派单说明',
		autoHeight:true,
		autoWidth :true,
		labelWidth: 130,
		labelAlign:'right',
		region:'north',
		layout:'table',
		split:true,
		collapsible: true,
		frame:true,
		items:[this.customerDesGrid ]
	});
	
	this.customerFlowPanel = new Ext.form.FormPanel({
		title:'流转过程',
		autoHeight:true,
		autoWidth :true,
		labelWidth: 130,
		labelAlign:'right',
		region:'north',
		layout:'table',
		split:true,
		collapsible: true,
		frame:true,
		items:[this.customerFlowGrid ]
	});	
	 
	this.tabPanel = new Ext.TabPanel({
		region:'center'
	});
	this.tabPanel.add(this.basicPanel);
	this.tabPanel.activate(this.basicPanel);
	this.tabPanel.add(this.customerInfoPanel);
	this.tabPanel.add(this.customerFactorPanel1);
	this.tabPanel.add(this.customerFactorPanel2);
	this.tabPanel.add(this.customerFlowPanel);
	this.tabPanel.add(this.customerDesPanel);
	
	Maint.Show64.showInfo.superclass.constructor.call(this,{
		width:680,
		height:450,
		modal:true,
		autoScroll:false,
		closeAction:'hide',
		buttonAlign:'right',
		buttons:[this.colseButton],
		items:[this.tabPanel],
		listeners:{
		}
	});
	
};

Ext.extend(Maint.Show64.showInfo, Ext.Window, {
	initDetail: function(data){
		this.maintId = data.MAINT_ID;
	    this.txtWoNum.setValue(data.WO_NUM);
	    this.txtUrgency.setValue(data.URGENCY);
	    this.txtAcceptLimit.setValue(data.ACCEPT_LIMIT);
	    this.txtCreateTime.setValue(data.CREATE_TIME);
	    this.txtReplyLimit.setValue(data.REPLY_LIMIT);
	    this.txtFaultTime.setValue(data.FAULT_TIME);
	    this.txtRepeatWo.setValue(data.REPEAT_WO);
	    this.txtCreateDep.setValue(data.CREATE_DEP);
	    this.txtDealWithDep.setValue(data.DEAL_WITH_DEP);
	    this.txtFaultType.setValue(data.FAULT_TYPE);
	    this.txtFalutProject.setValue(data.FALUT_PROJECT);
	    this.txtMonitorWo.setValue(data.MONITOR_WO);
	    this.txtNum.setValue(data.NUM);
	    
	    this.customerDesStore.load({
	    	params:{maintId: data.MAINT_ID }
	    });
	   	this.customerFlowStore.load({
	    	params:{maintId: data.MAINT_ID }
	    });
	},
	
	initCustomerInfo: function(customerInfo){
		this.txtClientName.setValue(customerInfo.CLIENT_NAME);
	    this.txtMobileTele.setValue(customerInfo.MOBILE_TELE);
	    this.txtTeleType.setValue(customerInfo.TELE_TYPE);
		this.txtContactTele.setValue(customerInfo.CONTACT_TELE);
		this.txtContactLocation.setValue(customerInfo.CONTACT_LOCATION);
		this.txtGrid.setValue(customerInfo.GRID);
		this.txtLocation.setValue(customerInfo.LOCATION);
		this.txtClientAtt.setValue(customerInfo.CLIENT_ATT);
		this.txtBigClient.setValue(customerInfo.BIG_CLIENT);
	}
});